<template>
	<view>
		<view class="body-x" v-for="(item, index) in curData" :key="index">
			<view @click="$emit('on-click', item, index)">
				<lg-dynamic-item v-if="type == 'dynamic'" :data="item" :index="index"></lg-dynamic-item>
				<lg-issue-item ref="initReadMoreRef" v-if="type == 'issue'" :data="item" :index="index"></lg-issue-item>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		data: {
			type: Array,
			default: () => []
		},
		type: {
			type: String,
			default: 'dynamic',
			validator: v => ['dynamic', 'issue'].includes(v)
		}
	},
	watch: {
		data(v) {
			this.curData = v;
		}
	},
	data() {
		return {
			curData: this.data
		}
	},
	methods:{
		initReadMore(){
			this.$refs.initReadMoreRef.initReadMore()
		}
	}
};
</script>

<style lang="scss" scoped>
.body-x {
	width: 710rpx;
	background-color: #ffffff;
	margin: 20rpx auto;
	border-radius: 20rpx;
	box-sizing: border-box;
	padding: 20rpx;
	font-size: 28rpx;
}
</style>
